#include <unistd.h>
#include <sys/syscall.h>

#include "CurrentThread.h"

namespace Logger
{
    thread_local int tCacheTid = 0;

    void getCacheTid()
    {
        if (tCacheTid == 0)
        {
            // syscall()拿到内核实际tid
            tCacheTid = static_cast<pid_t>(::syscall(SYS_gettid));
        }
    }
} // namespace Logger